Example #1
0
    def test_check_user_no_user(self, mock_dynamodb):
        mock_table = Mock()
        mock_table.get_item.return_value = {'ResponseMetadata': {}}
        mock_dynamodb.return_value.Table.return_value = mock_table

        db_provider = DBProvider('tlgmUsers', 'tlgmSettings')
        self.assertFalse(db_provider.check_user("user_1", "pwd"))
Example #2
0
    def test_check_user_without_pswd(self, mock_dynamodb):
        mock_table = Mock()
        mock_table.get_item.return_value = {
            'Item': {
                'chat_id': 1044617900,
                'user_id': 'user_1'
            },
            'ResponseMetadata': {}
        }
        mock_dynamodb.return_value.Table.return_value = mock_table

        db_provider = DBProvider('tlgmUsers', 'tlgmSettings')
        self.assertFalse(db_provider.check_user("user_1", ""))
Example #3
0
    def test_check_user_correct_pswd(self, mock_dynamodb):
        mock_table = Mock()
        mock_table.get_item.return_value = {
            'Item': {
                'chat_id': 1044617899,
                'password': '******',
                'user_id': 'user_1'
            },
            'ResponseMetadata': {}
        }
        mock_dynamodb.return_value.Table.return_value = mock_table

        db_provider = DBProvider('tlgmUsers', 'tlgmSettings')
        self.assertTrue(db_provider.check_user("user_1", "pwd"))