Skip to content

Commit d484155

Browse files
authored
Merge pull request #38 from CodeMakerInc/fury-extensions
Fury extension
2 parents 9c7b903 + 36a5072 commit d484155

21 files changed

+721
-10
lines changed

EppLib.UnitTests/EppLib.UnitTests.csproj

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
<Compile Include="NominetExtensionLocalTest.cs" />
5858
<Compile Include="Properties\AssemblyInfo.cs" />
5959
<Compile Include="IisExtensionLocalTest.cs" />
60+
<Compile Include="FuryExtensionLocalTest.cs" />
6061
<Compile Include="SecDNSExtensionLocalTest.cs" />
6162
</ItemGroup>
6263
<ItemGroup>
@@ -117,6 +118,24 @@
117118
<Content Include="TestData\ContactUpdateResponse1.xml">
118119
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
119120
</Content>
121+
<Content Include="TestData\FuryGetAgreementResponse.xml">
122+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
123+
</Content>
124+
<Content Include="TestData\FuryGetAgreement.xml">
125+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
126+
</Content>
127+
<Content Include="TestData\FuryContactUpdateCommand.xml">
128+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
129+
</Content>
130+
<Content Include="TestData\FuryContactCreateCommand.xml">
131+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
132+
</Content>
133+
<Content Include="TestData\FuryDomainUpdateCommand.xml">
134+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
135+
</Content>
136+
<Content Include="TestData\FuryDomainCreateCommand.xml">
137+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
138+
</Content>
120139
<Content Include="TestData\DomainNameCancelledNotification.xml">
121140
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
122141
</Content>
@@ -126,6 +145,9 @@
126145
<Content Include="TestData\ClaimCheckCommand.xml">
127146
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
128147
</Content>
148+
<Content Include="TestData\FuryLoginCommand.xml">
149+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
150+
</Content>
129151
<Content Include="TestData\NominetContactInfoResponse1.xml">
130152
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
131153
</Content>
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
using EppLib.Entities;
2+
using EppLib.Extensions.Fury;
3+
using Microsoft.VisualStudio.TestTools.UnitTesting;
4+
using System.IO;
5+
using System.Text;
6+
using System.Xml;
7+
8+
namespace EppLib.Tests
9+
{
10+
[TestClass]
11+
public class FuryExtensionLocalTest
12+
{
13+
[TestMethod]
14+
[TestCategory("FuryExtension")]
15+
[DeploymentItem("TestData/FuryLoginCommand.xml")]
16+
public void FuryLogin()
17+
{
18+
string expected = File.ReadAllText("FuryLoginCommand.xml");
19+
20+
var command = new Login("username", "password");
21+
command.Options = new Options { MLang = "en", MVersion = "1.0" };
22+
23+
var services = new Services();
24+
25+
services.ObjURIs.Add("urn:ietf:params:xml:ns:epp-1.0");
26+
services.ObjURIs.Add("urn:ietf:params:xml:ns:domain-1.0");
27+
services.ObjURIs.Add("urn:ietf:params:xml:ns:host-1.0");
28+
services.ObjURIs.Add("urn:ietf:params:xml:ns:contact-1.0");
29+
30+
//Fury extension
31+
services.Extensions.Add("urn:ietf:params:xml:ns:fury-2.0");
32+
33+
command.Services = services;
34+
command.TransactionId = "ABC-12345";
35+
36+
var xml = command.ToXml().InnerXml;
37+
38+
Assert.AreEqual(expected, xml);
39+
}
40+
41+
42+
[TestMethod]
43+
[TestCategory("FuryExtension")]
44+
[DeploymentItem("TestData/FuryDomainCreateCommand.xml")]
45+
public void FuryCreateDomainWithPrivacy()
46+
{
47+
string expected = File.ReadAllText("FuryDomainCreateCommand.xml");
48+
49+
var command = new DomainCreate("mydomain.ca", "jd1234");
50+
command.Password = "2fooBAR";
51+
command.DomainContacts.Add(new DomainContact("sh8013", "admin"));
52+
command.DomainContacts.Add(new DomainContact("sh8013", "tech"));
53+
54+
command.Extensions.Add(new FuryDomainCreateExtension(true));
55+
56+
var xml = command.ToXml().InnerXml;
57+
58+
Assert.AreEqual(expected, xml);
59+
}
60+
61+
[TestMethod]
62+
[TestCategory("FuryExtension")]
63+
[DeploymentItem("TestData/FuryDomainUpdateCommand.xml")]
64+
public void FuryUpdateDomainWithPrivacy()
65+
{
66+
string expected = File.ReadAllText("FuryDomainUpdateCommand.xml");
67+
68+
var command = new DomainUpdate("example.com");
69+
70+
var domainChange = new DomainChange { AuthInfo = "password2" };
71+
72+
command.DomainChange = domainChange;
73+
command.Extensions.Add(new FuryDomainUpdateExtension(false));
74+
75+
var xml = command.ToXml().InnerXml;
76+
77+
Assert.AreEqual(expected, xml);
78+
}
79+
80+
[TestMethod]
81+
[TestCategory("FuryExtension")]
82+
[DeploymentItem("TestData/FuryContactCreateCommand.xml")]
83+
public void FuryContactCreateWithPrivacy()
84+
{
85+
string expected = File.ReadAllText("FuryContactCreateCommand.xml");
86+
87+
var registrantContact = new Contact("agreed6",
88+
"Test Contact1", "Test Organization",
89+
"Ottawa", "123 Main Street", "ON", "K1R 7S8", "CA",
90+
"jdoe@example.com",
91+
new Telephone { Value = "+1.6471114444", Extension = "333" },
92+
new Telephone { Value = "+1.6471114445" });
93+
//registrantContact.Password = "password";
94+
var command = new ContactCreate(registrantContact);
95+
command.Password = "password";
96+
var furyExtension = new FuryContactCreateExtension("EN", "CCT", null);
97+
98+
command.Extensions.Add(furyExtension);
99+
100+
var xml = command.ToXml().InnerXml;
101+
102+
Assert.AreEqual(expected, xml);
103+
}
104+
105+
106+
[TestMethod]
107+
[TestCategory("FuryExtension")]
108+
[DeploymentItem("TestData/FuryContactUpdateCommand.xml")]
109+
public void FuryContactUpdateWithPrivacy()
110+
{
111+
string expected = File.ReadAllText("FuryContactUpdateCommand.xml");
112+
113+
var command = new ContactUpdate("agreed2");
114+
115+
//change contact email and language
116+
var contactChange = new ContactChange();
117+
118+
contactChange.Email = "noprops@domain.fr";
119+
120+
command.ContactChange = contactChange;
121+
122+
command.Extensions.Add(new FuryContactUpdateExtension("en", "fr"));
123+
124+
var xml = command.ToXml().InnerXml;
125+
126+
Assert.AreEqual(expected, xml);
127+
}
128+
129+
130+
[TestMethod]
131+
[TestCategory("FuryExtension")]
132+
[DeploymentItem("TestData/FuryGetAgreement.xml")]
133+
public void FuryGetAgreement()
134+
{
135+
string expected = File.ReadAllText("FuryGetAgreement.xml");
136+
137+
var command = new GetAgreement("EN", null);
138+
139+
var xml = command.ToXml().InnerXml;
140+
141+
Assert.AreEqual(expected, xml);
142+
}
143+
144+
[TestMethod]
145+
[TestCategory("FuryExtension")]
146+
[DeploymentItem("TestData/FuryGetAgreementResponse.xml")]
147+
public void FuryGetAgreementResponse()
148+
{
149+
string str = File.ReadAllText("FuryGetAgreementResponse.xml");
150+
151+
var getAgreementResponse = new GetAgreementResponse(Encoding.UTF8.GetBytes(str));
152+
153+
Assert.AreEqual(getAgreementResponse.Agreement, "Cogito ergo sum");
154+
}
155+
}
156+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?><epp xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:ietf:params:xml:ns:epp-1.0"><command><create><contact:create xmlns:contact="urn:ietf:params:xml:ns:contact-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:contact-1.0 contact-1.0.xsd"><contact:id>agreed6</contact:id><contact:postalInfo type="loc"><contact:name>Test Contact1</contact:name><contact:org>Test Organization</contact:org><contact:addr><contact:street>123 Main Street</contact:street><contact:city>Ottawa</contact:city><contact:sp>ON</contact:sp><contact:pc>K1R 7S8</contact:pc><contact:cc>CA</contact:cc></contact:addr></contact:postalInfo><contact:voice x="333">+1.6471114444</contact:voice><contact:fax>+1.6471114445</contact:fax><contact:email>jdoe@example.com</contact:email><contact:authInfo><contact:pw>password</contact:pw></contact:authInfo></contact:create></create><extension><fury:create xmlns:fury="urn:ietf:params:xml:ns:fury-2.0"><fury:properties><fury:property><fury:key>LANGUAGE</fury:key><fury:value>EN</fury:value></fury:property><fury:property><fury:key>CPR</fury:key><fury:value>CCT</fury:value></fury:property><fury:property><fury:key>agreement_version</fury:key><fury:value default="true" /></fury:property></fury:properties></fury:create></extension></command></epp>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?><epp xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:ietf:params:xml:ns:epp-1.0"><command><update><contact:update xmlns:contact="urn:ietf:params:xml:ns:contact-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:contact-1.0 contact-1.0.xsd"><contact:id>agreed2</contact:id><contact:chg><contact:email>noprops@domain.fr</contact:email></contact:chg></contact:update></update><extension><fury:update xmlns:fury="urn:ietf:params:xml:ns:fury-2.0"><fury:add><fury:properties><fury:property><fury:key>language</fury:key><fury:value>fr</fury:value></fury:property></fury:properties></fury:add><fury:rem><fury:properties><fury:property><fury:key>language</fury:key><fury:value>en</fury:value></fury:property></fury:properties></fury:rem></fury:update></extension></command></epp>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?><epp xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:ietf:params:xml:ns:epp-1.0"><command><create><domain:create xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd"><domain:name>mydomain.ca</domain:name><domain:registrant>jd1234</domain:registrant><domain:contact type="admin">sh8013</domain:contact><domain:contact type="tech">sh8013</domain:contact><domain:authInfo><domain:pw>2fooBAR</domain:pw></domain:authInfo></domain:create></create><extension><fury:create xmlns:fury="urn:ietf:params:xml:ns:fury-2.0"><fury:properties><fury:property><fury:key>PRIVACY</fury:key><fury:value>PRIVATE</fury:value></fury:property></fury:properties></fury:create></extension></command></epp>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?><epp xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:ietf:params:xml:ns:epp-1.0"><command><update><domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd"><domain:name>example.com</domain:name><domain:chg><domain:authInfo><domain:pw>password2</domain:pw></domain:authInfo></domain:chg></domain:update></update><extension><fury:update xmlns:fury="urn:ietf:params:xml:ns:fury-2.0"><fury:add><fury:properties><fury:property><fury:key>PRIVACY</fury:key><fury:value>PUBLIC</fury:value></fury:property></fury:properties></fury:add><fury:rem><fury:properties><fury:property><fury:key>PRIVACY</fury:key><fury:value>PRIVATE</fury:value></fury:property></fury:properties></fury:rem></fury:update></extension></command></epp>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?><epp xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:ietf:params:xml:ns:epp-1.0"><extension><fury:command xmlns:fury="urn:ietf:params:xml:ns:fury-2.0"><fury:info><fury:language>EN</fury:language><fury:properties><fury:property><fury:key>AGREEMENT_VERSION</fury:key><fury:value default="true" /></fury:property></fury:properties></fury:info></fury:command></extension></epp>
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
3+
<response>
4+
<result code="1000">
5+
<msg>Command completed successfully</msg>
6+
</result>
7+
<extension>
8+
<fury:response xmlns:fury="urn:ietf:params:xml:ns:fury-2.0">
9+
<fury:infData>
10+
<fury:language>en</fury:language>
11+
<fury:properties>
12+
<fury:property>
13+
<fury:key>AGREEMENT_VERSION</fury:key>
14+
<fury:localizedKey>Agreement Version</fury:localizedKey>
15+
<fury:propertyValues>
16+
<fury:propertyValue>
17+
<fury:value default="true">2.0</fury:value>
18+
<fury:localizedValue>2.0</fury:localizedValue>
19+
<fury:localizedDetail>Cogito ergo sum</fury:localizedDetail>
20+
<fury:propertyValueAttributes>
21+
<fury:propertyValueAttribute>
22+
<fury:key>expiry_date</fury:key>
23+
<fury:value>3000-01-01T00:00:00.000Z</fury:value>
24+
</fury:propertyValueAttribute>
25+
<fury:propertyValueAttribute>
26+
<fury:key>effective_date</fury:key>
27+
<fury:value>2018-03-14T20:04:10.618Z</fury:value>
28+
</fury:propertyValueAttribute>
29+
<fury:propertyValueAttribute>
30+
<fury:key>enabled</fury:key>
31+
<fury:value>true</fury:value>
32+
</fury:propertyValueAttribute>
33+
</fury:propertyValueAttributes>
34+
</fury:propertyValue>
35+
</fury:propertyValues>
36+
<fury:propertyAttributes>
37+
<fury:propertyAttribute>
38+
<fury:key>entitytype</fury:key>
39+
<fury:value>contact</fury:value>
40+
</fury:propertyAttribute>
41+
<fury:propertyAttribute>
42+
<fury:key>removable</fury:key>
43+
<fury:value>false</fury:value>
44+
</fury:propertyAttribute>
45+
<fury:propertyAttribute>
46+
<fury:key>propertytype</fury:key>
47+
<fury:value>SINGLEENUM</fury:value>
48+
</fury:propertyAttribute>
49+
<fury:propertyAttribute>
50+
<fury:key>updatable</fury:key>
51+
<fury:value>true</fury:value>
52+
</fury:propertyAttribute>
53+
</fury:propertyAttributes>
54+
</fury:property>
55+
</fury:properties>
56+
</fury:infData>
57+
</fury:response>
58+
</extension>
59+
<trID>
60+
<svTRID>CIRA-000000002723-0000000003</svTRID>
61+
</trID>
62+
</response>
63+
</epp>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?><epp xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:ietf:params:xml:ns:epp-1.0"><command><login><clID>username</clID><pw>password</pw><options><version>1.0</version><lang>en</lang></options><svcs><objURI>urn:ietf:params:xml:ns:epp-1.0</objURI><objURI>urn:ietf:params:xml:ns:domain-1.0</objURI><objURI>urn:ietf:params:xml:ns:host-1.0</objURI><objURI>urn:ietf:params:xml:ns:contact-1.0</objURI><svcExtension><extURI>urn:ietf:params:xml:ns:fury-2.0</extURI></svcExtension></svcs></login><clTRID>ABC-12345</clTRID></command></epp>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?xml version="1.0" encoding="UTF-8" standalone="no"?><epp xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:ietf:params:xml:ns:epp-1.0"><command><update><domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd"><domain:name>example1</domain:name></domain:update></update><extension><secDNS:update xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1"><secDNS:rem><secDNS:dsData><secDNS:keyTag>12345</secDNS:keyTag><secDNS:alg>5</secDNS:alg><secDNS:digestType>1</secDNS:digestType><secDNS:digest>49FD46E6C4B45C55D4AC</secDNS:digest></secDNS:dsData></secDNS:rem><secDNS:add><secDNS:dsData><secDNS:keyTag>12346</secDNS:keyTag><secDNS:alg>5</secDNS:alg><secDNS:digestType>1</secDNS:digestType><secDNS:digest>38EC35D5B3A34B44C39B</secDNS:digest></secDNS:dsData></secDNS:add></secDNS:update></extension></command></epp>
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?><epp xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:ietf:params:xml:ns:epp-1.0"><command><update><domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd"><domain:name>example1</domain:name></domain:update></update><extension><secDNS:update xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1" xsi:schemaLocation="urn:ietf:params:xml:ns:secDNS-1.1 secDNS-1.1.xsd"><secDNS:rem><secDNS:dsData><secDNS:keyTag>12345</secDNS:keyTag><secDNS:alg>5</secDNS:alg><secDNS:digestType>1</secDNS:digestType><secDNS:digest>49FD46E6C4B45C55D4AC</secDNS:digest></secDNS:dsData></secDNS:rem><secDNS:add><secDNS:dsData><secDNS:keyTag>12346</secDNS:keyTag><secDNS:alg>5</secDNS:alg><secDNS:digestType>1</secDNS:digestType><secDNS:digest>38EC35D5B3A34B44C39B</secDNS:digest></secDNS:dsData></secDNS:add></secDNS:update></extension></command></epp>

0 commit comments

Comments
 (0)