def test_get_status(self): now = datetime.utcnow() couch_user = CommCareUser.get_by_username(self.username) UserFixtureStatus( user_id=self.couch_user._id, fixture_type=UserFixtureType.CHOICES[0][0], last_modified=now, ).save() self.assertEqual(self.couch_user.fixture_status("fake_status"), UserFixtureStatus.DEFAULT_LAST_MODIFIED) self.assertEqual(couch_user.fixture_status(UserFixtureType.CHOICES[0][0]), now)
def test_get_statuses(self): no_status = {UserFixtureType.CHOICES[0][0]: UserFixtureStatus.DEFAULT_LAST_MODIFIED} self.assertEqual(self.couch_user._get_fixture_statuses(), no_status) now = datetime.utcnow() UserFixtureStatus( user_id=self.couch_user._id, fixture_type=UserFixtureType.CHOICES[0][0], last_modified=now, ).save() expected_status = {UserFixtureType.CHOICES[0][0]: now} self.assertEqual(self.couch_user._get_fixture_statuses(), expected_status)