Beispiel #1
0
 def test_error_args(self, test_input):
     with pytest.raises(EmmentalDateException):
         document = Document(
             _id=test_input["_id"],
             created_at=test_input["created_at"],
             updated_at=test_input["updated_at"],
         )
Beispiel #2
0
    def test_init(self, test_input, expected):
        document = Document(
            _id=test_input["_id"],
            created_at=test_input["created_at"],
            updated_at=test_input["updated_at"],
        )

        assert document._id == expected["_id"]
        assert document.created_at == expected["created_at"]
        assert document.updated_at == expected["updated_at"]
Beispiel #3
0
    def test_default_init(self):
        t_before = int(time.time())
        document = Document()
        t_after = int(time.time())

        # assert _id is not undefined
        assert document._id

        assert document.created_at
        assert document.created_at >= t_before
        assert document.created_at <= t_after

        assert document.updated_at
        assert document.updated_at >= t_before
        assert document.updated_at <= t_after
Beispiel #4
0
 def from_dict(dict_object: dict):
     return Document.from_dict_class(dict_object, User)
Beispiel #5
0
 def from_dict(dict_object: dict):
     dict_object["total_points"] = int(dict_object["total_points"])
     return Document.from_dict_class(dict_object, Challenge)
Beispiel #6
0
 def from_dict(dict_object: dict):
     return Document.from_dict_class(dict_object, ChallengeCategory)
Beispiel #7
0
 def from_dict(dict_object: dict):
     return Document.from_dict_class(dict_object, ChallengeParticipation)