Beispiel #1
0
class ArtistTest(TestCase):

    def setUp(self):
        """
        """
        self.user = User.objects.create(
            username='******',
            first_name = 'John',
            last_name = 'Doe',
            email = '*****@*****.**',
            password = '******',
            )
        self.artist = Artist(user = self.user,
                             name = 'The Edens Experience',
                             description = 'This is a test artist.',
                             email_address = '*****@*****.**',
                             telephone_number = '401-529-0760',
                             pay_to_the_order_of = 'Brandon Edens',
                             address1 = '115 Empire St.',
                             city = 'Providence',
                             state = 'RI',
                             zipcode = '02903'
                             )
        self.artist.save()

    def test_name_handling_the(self):
        """
        """
        self.artist.name = 'tHe Edens Experience'
        self.artist.save()
        # Test that name is stored correctly.
        self.assertEquals(self.artist.name, 'Edens Experience, tHe')
        # Test that name is printed correctly.
        self.assertEquals(self.artist.__unicode__(), 'tHe Edens Experience')

    def test_name_handling_almost_the(self):
        """
        """
        self.artist.name = 'Theo Edens Experience'
        self.artist.save()
        # Test that name is not modified.
        self.assertEquals(self.artist.name, 'Theo Edens Experience')
        # Test that not modified name is printed correctly.
        self.assertEquals(self.artist.__unicode__(), 'Theo Edens Experience')

    def test_absolute_url(self):
        """
        """
        self.assertEquals(self.artist.get_absolute_url(),
                          "/artist/detail/%d/" % self.artist.id)
Beispiel #2
0
class ArtistTest(TestCase):
    def setUp(self):
        """
        """
        self.user = User.objects.create(
            username='******',
            first_name='John',
            last_name='Doe',
            email='*****@*****.**',
            password='******',
        )
        self.artist = Artist(user=self.user,
                             name='The Edens Experience',
                             description='This is a test artist.',
                             email_address='*****@*****.**',
                             telephone_number='401-529-0760',
                             pay_to_the_order_of='Brandon Edens',
                             address1='115 Empire St.',
                             city='Providence',
                             state='RI',
                             zipcode='02903')
        self.artist.save()

    def test_name_handling_the(self):
        """
        """
        self.artist.name = 'tHe Edens Experience'
        self.artist.save()
        # Test that name is stored correctly.
        self.assertEquals(self.artist.name, 'Edens Experience, tHe')
        # Test that name is printed correctly.
        self.assertEquals(self.artist.__unicode__(), 'tHe Edens Experience')

    def test_name_handling_almost_the(self):
        """
        """
        self.artist.name = 'Theo Edens Experience'
        self.artist.save()
        # Test that name is not modified.
        self.assertEquals(self.artist.name, 'Theo Edens Experience')
        # Test that not modified name is printed correctly.
        self.assertEquals(self.artist.__unicode__(), 'Theo Edens Experience')

    def test_absolute_url(self):
        """
        """
        self.assertEquals(self.artist.get_absolute_url(),
                          "/artist/detail/%d/" % self.artist.id)
Beispiel #3
0
 def setUp(self):
     """
     """
     self.user = User.objects.create(
         username='******',
         first_name='John',
         last_name='Doe',
         email='*****@*****.**',
         password='******',
     )
     self.artist = Artist(user=self.user,
                          name='The Edens Experience',
                          description='This is a test artist.',
                          email_address='*****@*****.**',
                          telephone_number='401-529-0760',
                          pay_to_the_order_of='Brandon Edens',
                          address1='115 Empire St.',
                          city='Providence',
                          state='RI',
                          zipcode='02903')
     self.artist.save()
Beispiel #4
0
def artist_create(request):
    """
    Create a new artist.
    """
    artist = Artist(user=request.user)
    if request.method == 'POST':
        form = ArtistForm(request.POST, instance=artist)
        if form.is_valid():
            artist = form.save()
            return redirect_to(request,
                               reverse('artist_detail', args=[artist.id]))
    else:
        form = ArtistForm(instance=artist)
    return direct_to_template(request, 'profile/artist_form.html', {
        'form': form,
    })
Beispiel #5
0
 def setUp(self):
     """
     """
     self.user = User.objects.create(
         username='******',
         first_name = 'John',
         last_name = 'Doe',
         email = '*****@*****.**',
         password = '******',
         )
     self.artist = Artist(user = self.user,
                          name = 'The Edens Experience',
                          description = 'This is a test artist.',
                          email_address = '*****@*****.**',
                          telephone_number = '401-529-0760',
                          pay_to_the_order_of = 'Brandon Edens',
                          address1 = '115 Empire St.',
                          city = 'Providence',
                          state = 'RI',
                          zipcode = '02903'
                          )
     self.artist.save()