コード例 #1
0
 def test_is_an_active_curator(self, mock_search):
     mock_search.return_value = MockQuery(self.db_user)
     exp = (Dbuser.email == self.db_user.email) & (Dbuser.status == 'Current')
     
     self.assertEqual(curator_or_none(self.db_user.email), self.db_user)
     self.assertTrue(mock_search.called_with(Dbuser))
     self.assertTrue(exp.compare(mock_search.return_value._query_filter.query_params()))
コード例 #2
0
    def test_is_an_active_curator(self, mock_search):
        mock_search.return_value = MockQuery(self.db_user)
        exp = (Dbuser.email == self.db_user.email) & (Dbuser.status
                                                      == 'Current')

        self.assertEqual(curator_or_none(self.db_user.email), self.db_user)
        self.assertTrue(mock_search.called_with(Dbuser))
        self.assertTrue(
            exp.compare(mock_search.return_value._query_filter.query_params()))
コード例 #3
0
    def test_is_an_inexistent_curator(self, mock_search):
        self.db_user.status = 'Former'
        mock_search.return_value = MockQuery(None)

        self.assertEqual(curator_or_none(self.db_user.email), None)
        self.assertTrue(mock_search.called_with(Dbuser))
コード例 #4
0
 def test_is_an_inexistent_curator(self, mock_search):
     self.db_user.status = 'Former'
     mock_search.return_value = MockQuery(None)
     
     self.assertEqual(curator_or_none(self.db_user.email), None)
     self.assertTrue(mock_search.called_with(Dbuser))