# Path: groups/models.py
# def group_uri2id( group_uri ):
# def group_id2uri( group_id ):
# def create_group( address, description, sequence ):
# def _group2json(group_db):
# def get_group( group_uri ):
# def get_groups( sequence=None ):
# def get_member_groups( member_email ):
# def add_group_member( group_uri, member_email ):
# def remove_group_member( group_uri, member_email ):
# def sync_group_with_mailgun( group_uri ):


from django.test import TestCase
from groups import models as group_model


class SimpleTest(TestCase):
    def test_create_group(self):
        """
        Test group creation
        """
        group = group_model.create_group('ateam@mechmooc.com', 'The A team', 1)
        self.assertTrue('address' in group)
        self.assertTrue('description' in group)
        self.assertTrue('members' in group)
        self.assertTrue('sequence' in group)
        group_copy = group_model.get_group(group['uri'])
        self.assertEqual(group, group_copy)


    def test_add_group_member(self):
        group = group_model.create_group('ateam@mechmooc.com', 'The A team', 1)
        group_model.add_group_member(group['uri'], 'bob@mail.com')

# Path: groups/models.py
# def group_uri2id( group_uri ):
# def group_id2uri( group_id ):
# def create_group( address, description, sequence ):
# def _group2json(group_db):
# def get_group( group_uri ):
# def get_groups( sequence=None ):
# def get_member_groups( member_email ):
# def add_group_member( group_uri, member_email ):
# def remove_group_member( group_uri, member_email ):
# def sync_group_with_mailgun( group_uri ):


# Path: groups/tests.py
from django.test import TestCase
from groups import models as group_model



class SimpleTest(TestCase):
    def test_create_group(self):
        """
        Test group creation
        """
        group = group_model.create_group('ateam@mechmooc.com', 'The A team', 1)
        self.assertTrue('address' in group)
        self.assertTrue('description' in group)
        self.assertTrue('members' in group)
        self.assertTrue('sequence' in group)
        group_copy = group_model.get_group(group['uri'])
        self.assertEqual(group, group_copy)


    def test_add_group_member(self):
        group = group_model.create_group('ateam@mechmooc.com', 'The A team', 1)
        group_model.add_group_member(group['uri'], 'bob@mail.com')

        group = group_model.get_group(group['uri'])