This repository was archived by the owner on Mar 17, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +0
-44
lines changed Expand file tree Collapse file tree 5 files changed +0
-44
lines changed Original file line number Diff line number Diff line change @@ -20,21 +20,6 @@ class MockFirebase : public FirebaseArduino {
20
20
MOCK_CONST_METHOD2 (begin, void (const String& host, const String& auth));
21
21
};
22
22
23
-
24
- class MockFirebaseRequest : public FirebaseRequest {
25
- public:
26
- MOCK_CONST_METHOD0 (name, const std::string&());
27
- MOCK_CONST_METHOD0 (response, const std::string&());
28
- MOCK_CONST_METHOD0 (error, const FirebaseError&());
29
- };
30
-
31
- class MockFirebaseStream : public FirebaseStream {
32
- public:
33
- MOCK_METHOD0 (available, bool ());
34
- MOCK_METHOD1 (read, Event(std::string& event));
35
- MOCK_CONST_METHOD0 (error, const FirebaseError&());
36
- };
37
-
38
23
} // modem
39
24
} // firebase
40
25
#endif // TEST_MOCK_FIREBASE_H
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ using ::testing::_;
16
16
class GetCommandTest : public ::testing::Test {
17
17
protected:
18
18
void SetUp () override {
19
- get_.reset (new MockFirebaseRequest ());
20
19
}
21
20
22
21
void FeedCommand (const String& path) {
@@ -26,26 +25,20 @@ class GetCommandTest : public ::testing::Test {
26
25
}
27
26
28
27
bool RunCommand (const FirebaseError& error) {
29
- EXPECT_CALL (*get_, error ())
30
- .WillRepeatedly (ReturnRef (error));
31
-
32
28
GetCommand getCmd (&fbase_);
33
29
return getCmd.execute (" GET" , &in_, &out_);
34
30
}
35
31
36
32
MockInputStream in_;
37
33
MockOutputStream out_;
38
34
MockFirebase fbase_;
39
- std::unique_ptr<MockFirebaseRequest> get_;
40
35
};
41
36
42
37
TEST_F (GetCommandTest, gets) {
43
38
const String path (" /test/path" );
44
39
FeedCommand (path);
45
40
46
41
const String value (" Test value" );
47
- EXPECT_CALL (*get_, response ())
48
- .WillOnce (ReturnRef (value));
49
42
50
43
EXPECT_CALL (out_, print (String (" +" )))
51
44
.WillOnce (Return (1 ));
Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ using ::testing::_;
17
17
class PushCommandTest : public ::testing::Test {
18
18
protected:
19
19
void SetUp () override {
20
- push_.reset (new MockFirebaseRequest ());
21
20
}
22
21
23
22
void FeedCommand (const String& path, const String& data) {
@@ -41,20 +40,13 @@ class PushCommandTest : public ::testing::Test {
41
40
}
42
41
43
42
bool RunExpectingData (const String& data, const FirebaseError& error) {
44
- EXPECT_CALL (*push_, error ())
45
- .WillRepeatedly (ReturnRef (error));
46
-
47
- EXPECT_CALL (fbase_, pushPtr (_, EncodeForJson (data)))
48
- .WillOnce (Return (ByMove (std::move (push_))));
49
-
50
43
PushCommand pushCmd (&fbase_);
51
44
return pushCmd.execute (" PUSH" , &in_, &out_);
52
45
}
53
46
54
47
MockInputStream in_;
55
48
MockOutputStream out_;
56
49
MockFirebase fbase_;
57
- std::unique_ptr<MockFirebaseRequest> push_;
58
50
};
59
51
60
52
TEST_F (PushCommandTest, sendsData) {
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ using ::testing::_;
16
16
class RemoveCommandTest : public ::testing::Test {
17
17
protected:
18
18
void SetUp () override {
19
- remove_.reset (new MockFirebaseRequest ());
20
19
}
21
20
22
21
void FeedCommand (const String& path) {
@@ -26,11 +25,6 @@ class RemoveCommandTest : public ::testing::Test {
26
25
}
27
26
28
27
bool RunCommand (const FirebaseError& error) {
29
- EXPECT_CALL (*remove_, error ())
30
- .WillRepeatedly (ReturnRef (error));
31
-
32
- EXPECT_CALL (fbase_, removePtr (_))
33
- .WillOnce (Return (ByMove (std::move (remove_))));
34
28
35
29
RemoveCommand command (&fbase_);
36
30
return command.execute (" REMOVE" , &in_, &out_);
@@ -39,7 +33,6 @@ class RemoveCommandTest : public ::testing::Test {
39
33
MockInputStream in_;
40
34
MockOutputStream out_;
41
35
MockFirebase fbase_;
42
- std::unique_ptr<MockFirebaseRequest> remove_;
43
36
};
44
37
45
38
TEST_F (RemoveCommandTest, success) {
Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ using ::testing::_;
17
17
class SetCommandTest : public ::testing::Test {
18
18
protected:
19
19
void SetUp () override {
20
- set_.reset (new MockFirebaseRequest ());
21
20
}
22
21
23
22
void FeedCommand (const String& path, const String& data) {
@@ -41,11 +40,6 @@ class SetCommandTest : public ::testing::Test {
41
40
}
42
41
43
42
bool RunExpectingData (const String& data, const FirebaseError& error) {
44
- EXPECT_CALL (*set_, error ())
45
- .WillRepeatedly (ReturnRef (error));
46
-
47
- EXPECT_CALL (fbase_, setPtr (_, EncodeForJson (data)))
48
- .WillOnce (Return (ByMove (std::move (set_))));
49
43
50
44
SetCommand setCmd (&fbase_);
51
45
return setCmd.execute (" SET" , &in_, &out_);
@@ -54,7 +48,6 @@ class SetCommandTest : public ::testing::Test {
54
48
MockInputStream in_;
55
49
MockOutputStream out_;
56
50
MockFirebase fbase_;
57
- std::unique_ptr<MockFirebaseRequest> set_;
58
51
};
59
52
60
53
TEST_F (SetCommandTest, sendsData) {
You can’t perform that action at this time.
0 commit comments